// 
// Api.js
// 海石后台管理
// 
// 2024/12/27.
// 

import data from "./data.json"
console.log(data)

export const ApiConfig = [
    {
        name: "当前日期中文",
        code: "$DateZh",
    },
    {
        name: "当前日期英文",
        code: "$DateEn",
    },
    {
        name: "任务测量日期中文",
        code: "$UpdatedTimeZh",
    },
    {
        name: "任务测量日期英文",
        code: "$UpdatedTimeEn",
    },
    {
        name: "任务名称",
        code: "$TaskName",
    },
    {
        name: "样品名称",
        code: "$SampleName",
    },
    {
        name: "样品序号",
        code: "$SampleNum",
    },
    {
        name: "任务名称-样品序号",
        code: "$TaskNameSampleNum",
    },
    {
        name: "公司名称",
        code: "$CompanyName",
    },
    {
        name: "任务测量结果",
        isArray: true,
        code: "$TaskTestResultList",
        codes: [
            {
                name: "列表序号",
                code: "$Number",
            },
            {
                name: "元素名称",
                code: "$ShowName",
            },
            {
                name: "元素符号",
                code: "$ElemSymbol",
            },
            {
                name: "元素浓度",
                code: "$ConcValue",
            }
        ]
    },
]

export const ApiData = {

}

/**
 * 设置api 数据
 */
function setApiData() {
    // 当前时间
    ApiData.$DateZh = $dayjs().format("YYYY年MM月DD日")
    ApiData.$DateEn = $dayjs().format("LL")

    // 任务生成或修改时间
    ApiData.$UpdatedTimeZh = $dayjs("2024-11-29").format("YYYY年MM月DD日")
    ApiData.$UpdatedTimeEn = $dayjs("2024-11-29").format("LL")

    // 任务名和样品名
    ApiData.$TaskName = "多金属贫矿"
    ApiData.$SampleName = "石英沙"
    ApiData.$SampleNum = "1"
    ApiData.$TaskNameSampleNum = ApiData.$TaskName + "-" + ApiData.$SampleNum


    // 任务测量结果
    ApiData.$TaskTestResultList = (data.DetailInfo.elemList || []).map((item, index) => {
        return {
            $Number: index + 1,
            $ShowName: item.ShowName,
            $ElemSymbol: item.ElemSymbol === "L.O.I" ? item.ElemSymbol : "",
            // $ElemSymbol: item.ElemSymbol,
            $ConcValue: item.ConcValue
        }
    })

    // 系统配置项
    ApiData.$CompanyName = "烟台海石科技有限公司"
}

setApiData()